home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / FILE_OK.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  54 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   FILE_OK .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB01.INC"
  22. $INCLUDE "DAS-NB02.INC"
  23. COLOR 7,0
  24. CLS
  25.  
  26. ? "┌─────────────────────────────────────────────────────────────────────────────
  27. ? "│ fLegalFile% ( FileSpec$ )
  28. ? "├─────────────────────────────────────────────────────────────────────────────
  29. ? "│ I found that some of the memory managers' error trapping was getting in the
  30. ? "│ way of PowerBASIC's error traps when opening files, etc. so this little job
  31. ? "│ checks FileSpec$ to see if the drive is ready, the path exists, and the file
  32. ? "│ name is not NULL.
  33. ? "│ It is used by fCreateFile% and fOpenFile%
  34. ? "└─────────────────────────────────────────────────────────────────────────────
  35. ?
  36.                                                 '┌───────────────────────────
  37. FileName$ = DIR$("*.*")                         '│ get a known file
  38. FileSpec$ = "I:\PUREJUNK\" + FileName$          '│ add an illegal drive:\path
  39.                                                 '│
  40. IF fLegalFile%( FileName$ ) THEN                '│ test the known file
  41.     PRINT FileName$; " IS OK!"                  '│
  42.   ELSE                                          '│
  43.     PRINT FileName$; " CAN'T BE OPENED"         '│ (this shouldn't happen!)
  44. END IF                                          '│
  45.                                                 '│
  46. PRINT                                           '│
  47.                                                 '│
  48. IF fLegalFile%( FileSpec$ ) THEN                '│ test the trash
  49.     PRINT FileSpec$; " IS OK!"                  '│ (this shouldn't happen!)
  50.   ELSE                                          '│
  51.     PRINT FileSpec$; " CAN'T BE OPENED"         '│
  52. END IF                                          '└───────────────────────────
  53.  
  54.